home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 12 / Cream of the Crop 12 (Part II) / Cream of the Crop 12 (Part II).iso / OS2 / FTPFID16.ZIP / FTPSEND.CMD < prev    next >
Encoding:
Text File  |  1996-02-22  |  20.8 KB  |  695 lines

  1. /* FTPFIDO.CMD - rexx script to get FidoNet mail via FTP */
  2.  
  3. /*------------------------------------------------------------------
  4.  * Version 1.6send by Jerry Gause 1:3651/9
  5.  * This version simply sends *.* from "ftpout" for
  6.  * MFLO users.
  7.  * Many thanks go to John Souvestre for the original base code
  8.  * and of course to Patrick J. Mueller & Cliff Nadler for RxFtp.
  9.  * Change global variables below to suit your system.
  10.  * Change lines marked with "CFP!!!" to suit your provider.
  11.  * Important!!!!!!!!!!!!!
  12.  * Dlls needed for this script are: RxFtp, Rexxutil and Rexxlib.
  13.  * Rxftp is included in it's own archive.
  14.  * If using OS/2 2.X be sure to use the Rxftp32.Dll renamed
  15.  * to Rxftp.dll.
  16.  * Rexxlib was not included because it's shareware.
  17.  * You can freq it from me as Rexxlb.Zip.
  18.  * Lot's of error checking and logging of errors as well as normal
  19.  * operation. If anything goes wrong, it is logged and the session
  20.  * is aborted. 
  21.  *------------------------------------------------------------------*/
  22.  
  23. '@echo off'
  24. host = "ftp.sstar.com"
  25. name = ""
  26. password = ""
  27. seqfile  = 'f:\bbs\ftpfido.seq'
  28. inbound = 'd:\ftpin2'   /* Binkley or FD secure inbound */
  29. ftpin = 'd:\ftpin' /* Inbound for FTP */
  30. ftpout = 'd:\ftpout' /* Outbound for FTP */
  31. errlog = 'f:\bbs\logs\error.log' /* a logfile for errors */
  32. bsy = 'f:\binkley\IHUB.BSY'      /* local file sent as remote busy flag */
  33. remotebsyname = 'IHUB.BSY'    /* remote name for above */
  34. avbps = 2000 /* Your average bps rate */
  35. flg = 'f:\bbs\logs\Doing_ftp.flg' /* process flag */
  36. logfile  = 'F:\bbs\logs\ftpfido.log' /* Drive containing logs */
  37. listfile  = 'F:\bbs\logs\ftplist.log'
  38. mailbundle = 'd:\ftpin\f349fff8.*' /* I only move mailbundles from ftpin to inbound. Change to *.* if you move all */
  39. ndyet = 'd:\ftpin\ndyet.flg' /* Use this flag to prevent Allfix from running to prevent tics w/o files and vice versa */
  40. tcpbin = 'd:\tcpip\bin' /* where hangup.cmd is located to terminate slip session */
  41. hangup = 1  /* whether to hangup or not */
  42. scrlgth = 25
  43.  
  44. 'mode co80,'||scrlgth
  45.  
  46. bttm2 = scrlgth - 2
  47. bttm3 = scrlgth - 3
  48.  
  49. total_received = 0
  50. total_sent = 0
  51. total_uls = 0
  52. total_files = 0
  53. sizethere = 0
  54. howmucht = 0
  55. howlongt = 0
  56.  
  57. UpperCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
  58. LowerCase = 'abcdefghijklmnopqrstuvwxyz'
  59.  
  60. Signal on Syntax Name ErrorStop
  61. Signal on Halt Name Abort
  62. Signal on Failure Name FailureStop
  63.  
  64. rc = stream(logfile,'C','open write')
  65.  
  66. call Lineout logfile ,date('N') Time('N') 'FTPFIDO starting up.'
  67.  
  68. Call SysCurState Off
  69. Call CopyInfo
  70.  
  71. if RxFuncQuery("FtpLoadFuncs") then
  72.    do
  73.    rc = RxFuncAdd("FtpLoadFuncs","RxFtp","FtpLoadFuncs")
  74.    rc = FtpLoadFuncs(quiet)
  75.    end
  76.  
  77. if RxFuncQuery("SysLoadFuncs") then
  78.    do
  79.    rc = RxFuncAdd("SysLoadFuncs","RexxUtil","SysLoadFuncs")
  80.    rc = SysLoadFuncs()
  81.    end
  82.  
  83. if RxFuncQuery("rexxlibregister") then
  84.    do
  85.    rc = RxFuncAdd('rexxlibregister','rexxlib','rexxlibregister')
  86.    rc = rexxlibregister()
  87.    end
  88.  
  89. IF Stream(flg,'C', 'Query Exists') <>' ' Then
  90.     Do
  91.   say '!Must be running already.'
  92. rc = lineout(logfile,' Must be running already.')
  93.  signal exit
  94.     end
  95. else
  96.  do
  97. rc=doscreat(flg) /* Set process flag */
  98. IF rc <> 1 Then
  99.     Do
  100.   say '!Error creating flagfile.'
  101. rc = lineout(logfile,'!Error creating flagfile.')
  102.   signal exit
  103.     end
  104.  end
  105.  
  106. if hangup = 1 then do
  107. New = Directory(tcpbin)
  108. 'start /fs /c /b hangup.cmd 'killme
  109. end
  110.  
  111. killme = DosPid()
  112.     Call SysCurPos 0,21
  113.     say 'Process id: 'killme  'Begin: 'Time('N')''
  114.  
  115. /* Get the latest send sequence*/
  116. seqstr = "0123456789abcdefghijklmnopqrstuvwxyz"
  117. daywk = "mo tu we th fr sa su"
  118.  
  119. /* Contains the day and sequence*/
  120. IF Stream(seqfile,'C', 'Query Exists') <>' ' Then
  121.   Do
  122.   line = LINEIN(seqfile)
  123.   day = WORD(line, 1)
  124.   if POS(day, daywk) = 0 then
  125.     day = "mo"
  126.   seq = WORD(line, 2)
  127.   seqno = POS(seq, seqstr)
  128.   if seqno = 0 then do
  129.     seq = "0"
  130.     seqno = 1
  131.   end
  132.  end
  133. else do
  134.   file = LINEOUT(seqfile, 'mo 0')
  135.   seqno = 1
  136. end
  137. file = LINEOUT(seqfile)
  138.  
  139. rc = FtpSetBinary('Binary')
  140.  
  141. /*------------------------------------------------------------------
  142.  * LOGON
  143.  *------------------------------------------------------------------*/
  144.  
  145. rc = FtpSetUser(host, name, password) 
  146.  
  147. stime = time('e')
  148.  
  149. attached = FtpSys(siteinfo)
  150. Call SysCurPos 1,21
  151. say ''attached ''
  152. len = length(attached)
  153. if len > 8 then                                               /* CFP!!! */
  154. do
  155.     Call SysCurPos 2,21
  156.     rc = lineout(logfile,' Login successful')
  157.     say 'Login successful '
  158.     Call datetime
  159.  
  160.     rc = FtpChDir('..')                                         /* CFP!!! */
  161.  
  162.     rc = FtpPut(bsy,remotebsyname)
  163.     if err <> -1 & FTPERRNO <> '0' then
  164.     do
  165.     say '!Error putting busy flag on remote.'
  166.     rc = lineout(logfile,'!Error putting busy flag on remote.')
  167.     signal abort
  168.     end
  169.  
  170. /*------------------------------------------------------------------
  171.  * Change to remote inbound directory.
  172.  *------------------------------------------------------------------*/
  173.  
  174.     rc = FtpChDir("in")                                      /* CFP!!!! */
  175.     if err <> -1 & FTPERRNO <> '0' then
  176.     do
  177.     say '!Error changing directory on remote.'
  178.     rc = lineout(logfile,'!Error changing directory on remote.')
  179.     signal abort
  180.     end
  181.  
  182. /*------------------------------------------------------------------
  183.  * Send Files
  184.  *------------------------------------------------------------------*/
  185.  
  186. New=Directory(ftpout)
  187.  
  188.     rc = SysFileTree('*.*',outfile.,"F")
  189.     if outfile.0 > 0 then
  190.     do
  191.         sizethere = 0
  192.     x = 1
  193.     do outfile.0    /* loop through all the files here */
  194.          Call datetime
  195.  
  196.           ennd = scrlgth - 4
  197.           if p > ennd then do
  198.             p = ennd
  199.             do until p = 5
  200.             Call SysCurPos p,0
  201.             say "                                                  "
  202.             p = p - 1
  203.             end /* do until */
  204.            end
  205.  
  206.         filename = filespec("name", word(outfile.x,5))
  207.         fullname = word(outfile.x,5)
  208.         if filename <> '' & LENGTH(filename) > 3 & word(outfile.x,3) <> 0 then
  209.         do
  210.             /* Make sure the sequence is correct*/
  211.         posfile = LASTPOS('.', filename) + 1
  212.         setseq = SUBSTR(filename, posfile)
  213.         fday = TRANSLATE(DELSTR(setseq, 3))
  214.         fseq = TRANSLATE(SUBSTR(setseq, 3, 1))
  215.         fseqno = POS(fseq, seqstr)
  216.  
  217.         /* Check if the days match*/
  218.         if day = fday then 
  219.           do
  220.         if fseqno > seqno then 
  221.             do
  222.           seqno = fseqno
  223.           seq = SUBSTR(seqstr, seqno, 1)
  224.             end
  225.           end
  226.            else do
  227.            day = fday
  228.            seqno = fseqno
  229.            if seqno = 0 then seqno = 1
  230.            seq = SUBSTR(seqstr, seqno, 1)
  231.             end
  232.  
  233.              remfile1 = DELSTR(filename, posfile)||day||seq
  234.  
  235.            Trunc = 0
  236.            Nuke = 1    
  237.  
  238.            Call Put filename fullname word(outfile.x,3) remfile1
  239.  
  240.         /* Update the sequence file*/
  241.         'erase 'seqfile
  242.         seqno = seqno + 1
  243.         seq = SUBSTR(seqstr, seqno, 1)
  244.         file = LINEOUT(seqfile, day' 'seq)
  245.         file = LINEOUT(seqfile)
  246.             end
  247.            else
  248.           do
  249.           say '!'fullname' not found or 0 length.'
  250.           rc = lineout(logfile,'!'fullname' not found or 0 length.')
  251.           end
  252.        x = x + 1
  253.        p = p + 1
  254.     end /* Do loop */
  255.     end
  256.     if sizethere = '0' then
  257.     do
  258.     say ' No mail/files to send at this time.'
  259.     rc = lineout(logfile,' No mail/files to send at this time')
  260.         p = p + 1
  261.     end
  262. end
  263.  
  264. /*------------------------------------------------------------------
  265.  * Change to remote outbound directory.
  266.  *------------------------------------------------------------------*/
  267.  
  268.     rc = FtpChDir("..")                                 /* CFP!!!! */
  269.     if err <> -1 & FTPERRNO <> '0' then
  270.     do
  271.     say '!Error changing directory on remote.'
  272.     rc = lineout(logfile,'!Error changing directory on remote.')
  273.     signal abort
  274.     end
  275.     rc = FtpChDir("out")                                /* CFP!!!! */
  276.     if err <> -1 & FTPERRNO <> '0' then
  277.     do
  278.     say '!Error changing directory on remote.'
  279.     rc = lineout(logfile,'!Error changing directory on remote.')
  280.     signal abort
  281.     end
  282.  
  283.  
  284. /*------------------------------------------------------------------
  285.  * Get Mail and Files
  286.  *------------------------------------------------------------------*/
  287.  
  288.     New=Directory(ftpin)
  289.     rc = Ftpdir('*.*',infile.)  /* get list of files there for list */
  290.       if infile.0 > 0 & rc = 0 then
  291.    do
  292.       y = 0
  293.       'del 'listfile '> nul: 2>&1'
  294.       rc = stream(listfile,'C','open write')
  295.        total_bytes = 0
  296.        do i = 1 to infile.0
  297.     filename = word(infile.i,9)
  298.     size = word(infile.i,5)
  299.     total_bytes = total_bytes + size
  300.     rc = LINEOUT(listfile, filename size)
  301.         if y < bttm2 then do
  302.     Call SysCurPos y,55
  303.     say ''filename' -' size''
  304.         end 
  305.         y = y + 1
  306.        end
  307.     rc = stream(listfile,'C','close')
  308.     apxsecs = total_bytes%avbps
  309.     apxmins = apxsecs%60
  310.         bttm3 = scrlgth - 3
  311.     Call SysCurPos bttm3,0
  312.     say ' Receiving 'infile.0  'file(s) 'total_bytes' bytes 'apxmins' avg. mins.'
  313.     rc = lineout(logfile,' Receiving 'infile.0 'file(s) 'total_bytes' bytes 'apxmins' avg. mins.')
  314.     bps = 2000
  315.     x = 1                       /* reset the pointer */
  316.  
  317.     /* time to get files here from There */
  318.      do infile.0
  319.  
  320.      Call datetime
  321.  
  322.       ennd = scrlgth - 4
  323.       if p > ennd then do
  324.         p = ennd
  325.         do until p = 5
  326.         Call SysCurPos p,0
  327.         say "                                                  "
  328.         p = p - 1
  329.         end /* do until */
  330.        end
  331.  
  332.         filename = word(infile.x,9)
  333.  
  334.             if filename = "incoming" then  x = x + 1  /* CFP!!!! */
  335.             if filename = "incoming" then iterate    /* CFP!!!! */  
  336.  
  337.         Call Get filename word(infile.x,5)
  338.  
  339.     x = x + 1
  340.     p = p + 1
  341.      end /* Do loop */
  342.  end
  343.     else
  344.     do
  345.         Call SysCurPos p,0
  346.     rc = lineout(logfile,' No files to get')
  347.     say ' No files to get.'
  348.     end
  349.  
  350. /*------------------------------------------------------------------
  351.  * Change to remote root directory and remove busy flag.
  352.  *------------------------------------------------------------------*/
  353.  
  354.     rc = FtpChDir('..')
  355.     if err <> -1 & FTPERRNO <> '0' then
  356.     do
  357.     say '!Error changing directory on remote.'
  358.     rc = lineout(logfile,'!Error changing directory on remote.')
  359.     end
  360.     rc = FtpDelete(remotebsyname)
  361.     if err <> -1 & FTPERRNO <> '0' then
  362.     do
  363.     say '!Error deleting busy flag from remote.'
  364.     rc = lineout(logfile,'!Error deleting busy flag from remote.')
  365.     end
  366.  
  367.     signal done
  368.  
  369. end /* Login loop */
  370. else
  371. do
  372. Call SysCurPos 1,28
  373.     say '!Login failed... session aborted'
  374.     rc = lineout(logfile,'!Login failed... session aborted')
  375.     signal abort
  376. end
  377.  
  378.  
  379. /*------------------------------------------------------------------
  380.  * SubRoutines
  381.  *------------------------------------------------------------------*/
  382.  
  383. DateTime:
  384.     Call SysCurPos 3,21
  385.     say ''date('N') Time('N')''
  386. Return
  387.  
  388. /*------------------------------------------------------------------
  389.  * PUT
  390.  *------------------------------------------------------------------*/
  391.  
  392. Put:
  393. parse arg filehere fullname sizehere filethere
  394. o = 1
  395.  
  396. Call SysCurPos p,0
  397.  
  398. filethere = translate(filethere, LowerCase, UpperCase)
  399. if filehere <> filethere then
  400.  do
  401.    rc = lineout(logfile,' sending 'fullname '- 'sizehere 'bytes as 'filethere)
  402.    say ' Sending 'filehere ' - 'sizehere' bytes as 'filethere''
  403.  end
  404. else
  405.   do
  406.     rc = lineout(logfile,' sending 'fullname '- 'sizehere 'bytes')
  407.     say ' Sending 'filehere ' - 'sizehere' bytes '
  408.   end
  409.  
  410.   ustart = time('e')
  411.       
  412.   err = FtpPut(fullname, filethere, 'binary')
  413.  
  414.   uelapsed = time('e')
  415.  
  416.   howmuch = strip(uelapsed-ustart,,0)
  417.   bps = strip(format(sizehere/howmuch,10,0))
  418.         
  419.   if err = -1 & FTPERRNO = '0' then
  420.   do
  421.   /* add code to  test for good transfer by filesize */
  422.     rc = FtpDir(filethere,test.)     /* get size from remote */
  423.     if test.0 = 1 then /* it did get there  */
  424.      do
  425.     sizethere = word(test.1,5)
  426.      if sizehere = sizethere then /* if the same size, delete or truncate if necessary */
  427.       do
  428.       p = p + 1
  429.       Call SysCurPos p,0
  430.       total_sent = total_sent + sizethere /* get size for report */
  431.        howmucht = howmucht + howmuch
  432.            total_uls = total_uls + 1
  433.        Select
  434.         When Trunc = 1 then
  435.         do  
  436.         rc = lineout(logfile,' Successful - Truncating 'filehere)
  437.         say ' Truncating 'filehere''
  438.         rc=doscreat(fullname)
  439.         IF rc <> 1 Then
  440.           do
  441.         say '!Error truncating 'fullname''
  442.         rc = lineout(logfile,'!Error truncating 'fullname
  443.         signal abort
  444.           end
  445.         end
  446.         When Nuke = 1 then
  447.         do  
  448.         rc = lineout(logfile,' Successful - Deleting 'fullname)
  449.         say ' Deleting 'fullname''
  450.         rc = SysFileDelete(fullname)
  451.         IF rc <> 0 Then
  452.           do
  453.         say '!Error deleting 'fullname''
  454.         rc = lineout(logfile,'!Error deleting 'fullname
  455.         signal abort
  456.           end
  457.         end
  458.        otherwise
  459.        end /* Select */
  460.         p = p + 1
  461.         Call SysCurPos bttm2,0
  462.         say "                                                  "
  463.     Call SysCurPos bttm2,0
  464.     say ' Sent 'total_uls 'file(s) 'total_sent 'bytes 'howmucht%60 'min. 'strip(format(howmucht//60,3,0)) 'secs.'
  465.         Call SysCurPos p,0
  466.         say 'Sent 'filehere '- 'howmuch%60 'min. 'strip(format(howmuch//60,3,0)) 'secs. 'bps 'bps.'
  467.         rc = lineout(logfile,' sent 'filehere' - 'howmuch%60 'min. 'strip(format(howmuch//60,3,0)) 'secs. Baud = 'bps)
  468.       end /* size */
  469.     else
  470.       do
  471.         rc = lineout(logfile,'!Error in size - Deleting  'filethere 'from inbound')
  472.         say '!Error in size - Deleting  'filethere 'from inbound'
  473.         rc = FtpDelete(filethere)
  474.         if err <> -1 & FTPERRNO <> '0' then
  475.         do
  476.         say '!Error deleting 'filethere 'from remote.'
  477.         rc = lineout(logfile,'!Error deleting 'filethere 'from remote.')
  478.         signal abort
  479.         end
  480.       end
  481.      end /* test */
  482.     else
  483.        do
  484.        say '!Error in filetest'
  485.     rc = lineout(logfile,'!Error in filetest!')
  486.        signal xabort
  487.        end
  488.   end
  489.   else
  490.    do
  491.     say '!FTP returned error 'FTPERRNO''
  492.     rc = lineout(logfile,'!FTP returned error 'FTPERRNO)
  493.     signal xabort
  494.     end
  495.  
  496. Return
  497.  
  498. /*------------------------------------------------------------------
  499.  * GET
  500.  *------------------------------------------------------------------*/
  501.  
  502. Get:
  503. parse arg filename filesize
  504.  
  505. Call SysCurPos p,0
  506.  
  507.         say ' Recieving 'filename '- ' filesize 'bytes '
  508.         start = time('e')
  509.         err = FtpGet(filename, filename,"binary")    /* Transfer the file */
  510.         elapsed = time('e')
  511.  
  512.         if err = -1 & FTPERRNO = '0' then
  513.          do
  514.              sizehere = stream(filename,'C','query size')    /* get the filesize here */
  515.              if sizehere = filesize then
  516.               do
  517.             Call SysCurPos p,0
  518.         say "                                                  "
  519.             Call SysCurPos p,0
  520.         howlong = strip(elapsed-start,,0)
  521.         bps = strip(format(sizehere/howlong,10,0))
  522.         say 'Recieved 'filename '- 'howlong%60 'min. 'strip(format(howlong//60,3,0)) 'secs. 'bps 'bps.'
  523.         rc = lineout(logfile,' received 'filename' - 'sizehere' - 'howlong%60 'min. 'strip(format(howlong//60,3,0)) 'secs. Baud = 'bps)
  524.         total_received = total_received + sizehere
  525.         total_files = total_files + 1
  526.         rc = FtpDelete(filename)
  527.         if err <> -1 & FTPERRNO <> '0' then
  528.         do
  529.         say '!Error deleting 'filename 'from remote.'
  530.         rc = lineout(logfile,'!Error deleting 'filename 'from remote.')
  531.         end
  532.         Call SysCurPos bttm2,0
  533.         say "                                                  "
  534.         Call SysCurPos bttm2,0
  535.                 howlongt = howlongt + howlong
  536.         say ' Received 'total_files 'file(s) 'total_received 'bytes 'howlongt%60 'min. 'strip(format(howlongt//60,3,0)) 'secs.'
  537.         if bps < 500 & filesize > 50000 then
  538.         do
  539.         say '!Something ain''t right!! too slow??'
  540.         rc = lineout(logfile,'!Something went wrong with bps')
  541.         signal abort
  542.         end
  543.               end /* size */
  544.              else
  545.              do
  546.          say '!Error in filesize'
  547.          rc = lineout(logfile,'!Error in filesize')
  548.              x = x - 1
  549.          end
  550.          end
  551.         else 
  552.         do
  553.         say '!FTP returned error 'FTPERRNO''
  554.         rc = lineout(logfile,'!FTP returned error 'FTPERRNO)
  555.             signal xabort
  556.         end
  557.  
  558. Return
  559.  
  560. /*------------------------------------------------------------------
  561.  * Aborts
  562.  *------------------------------------------------------------------*/
  563.  
  564. Xabort:
  565. Call SysCurPos p,0
  566. say '!File transfer failed..'
  567. rc = lineout(logfile,'!File transfer failed..')
  568.  
  569. Abort:
  570. Call SysCurPos 3,28
  571. say '!Session Aborted'
  572. rc = lineout(logfile,'!Session Aborted')
  573.  
  574.  rc= doscreat(ndyet)
  575. if rc <> 1 Then
  576.     Do
  577.    say '!Error creating ndyet flag.'
  578.    rc = lineout(logfile,'!Error creating ndyet flag.')
  579.     end
  580.  
  581.     rc = FtpChDir('..')
  582.     rc = FtpDelete(remotebsyname)
  583.  
  584. signal Abort1
  585.  
  586. /*------------------------------------------------------------------
  587.  * DONE
  588.  *------------------------------------------------------------------*/
  589.  
  590. Done:
  591.  
  592. IF Stream(mailbundle,'C', 'Query Exists') <>' ' Then
  593.  do
  594.  New=Directory(inbound)
  595.  copy ftpin||'\*.* > nul: 2>&1'
  596.  del ftpin||'\*.* /N > nul: 2>&1'
  597.  end
  598.  
  599. /* 'echo mailproc | rxqueue mailproc' ------This triggers my mailtosser */
  600.  
  601. Abort1:
  602.  
  603.     rc = FtpSetUser("X","X","X")
  604.     rc = FtpLogoff()
  605.     rc = FtpDropFuncs()
  606.  
  607. Call SysCurPos bttm3,0
  608. Say "                                                                               "
  609. Call SysCurPos bttm2,0
  610. Say "                                                                               "
  611. Call SysCurPos bttm3,0
  612.  
  613. etime = time('e')
  614.  
  615. say ' Sent 'total_sent 'bytes, received 'total_received 'bytes in 'etime%60 'minutes, 'strip(format(etime//60,6,0)) 'seconds.'
  616. rc = lineout(logfile, ' $Sent 'total_sent 'bytes, received 'total_received 'bytes in 'etime%60 'minutes, 'strip(format(etime//60,10,0)) 'seconds.' )
  617. if total_sent > 0 then
  618. do
  619. say ' Total u/l time - 'howmucht%60 'min. 'strip(format(howmucht//60,3,0))' secs.  'strip(format(total_sent/howmucht,10,0))' avg. u/l bps.'
  620. rc = lineout(logfile, ' Total u/l time - 'howmucht%60 'min. 'strip(format(howmucht//60,3,0))' secs.  'strip(format(total_sent/howmucht,10,0))' avg. u/l bps.')
  621. end
  622. if total_received > 0 then
  623. do
  624. say ' Total d/l time - 'howlongt%60 'min. 'strip(format(howlongt//60,3,0))' secs.  'strip(format(total_received/howlongt,10,0))' avg. d/l bps.'
  625. say ' Sent 'total_uls 'files(s) Received 'total_files 'file(s).'
  626. rc = lineout(logfile, ' Total d/l time - 'howlongt%60 'min. 'strip(format(howlongt//60,3,0))' secs.  'strip(format(total_received/howlongt,10,0))' avg. d/l bps.')
  627. rc = lineout(logfile, ' Sent 'total_uls 'file(s) Received 'total_files 'file(s).')
  628. end
  629.  
  630.     /* remove process flag */
  631.       'del 'flg '> nul: 2>&1'
  632.        IF rc <> 0 Then
  633.        Do
  634.        say '!Error deleting 'flg''
  635.        rc = lineout(logfile,'!Error deleting 'flg)
  636.        end
  637.  
  638.     /* remove ndyet flag */
  639.      IF Stream(ndyet,'C', 'Query Exists') <>' ' Then
  640.       Do
  641.       'del 'ndyet' > nul: 2>&1'
  642.        IF rc <> 0 Then
  643.        Do
  644.        say '!Error deleting ndyet.flg'
  645.        rc = lineout(logfile,'!Error deleting ndyet.flg')
  646.        end
  647.       end
  648.  
  649. call Lineout logfile ,date('N') Time('N') 'FTPFIDO closing down.'
  650.  
  651. rc = stream(logfile,'C','close')
  652.  
  653. exit
  654.  
  655.  
  656. CopyInfo: Procedure
  657.  
  658. Call SysCls
  659.  
  660. Say '    ░░░░▒▒▒▒▓▓▓▓████'
  661. Say '      FTPFido'
  662. Say '   By Jerry Gause'
  663. Say 'Warped Software'
  664. Say '████▓▓▓▓▒▒▒▒░░░░    '
  665. Say ''
  666. Return
  667.  
  668. FailureStop:
  669. parse upper source tst
  670. tst=word(tst,3)
  671. tst=parsefn(tst)
  672. tst=word(tst,3)'.'word(tst,4)
  673.       say 'A Failure ('RC') has occurred on Line 'Sigl' in 'tst''
  674.       say 'ftpfido has Failure Exited'
  675.       call Lineout errlog ,date('N') Time('N') ':  ftpfido ,  A Failure ('RC') has occurred on Line 'Sigl' in 'tst
  676.    Signal Exit
  677.  
  678. ErrorStop:
  679. parse upper source tst
  680. tst=word(tst,3)
  681. tst=parsefn(tst)
  682. tst=word(tst,3)'.'word(tst,4)
  683.       say 'An Error ('RC') has occurred on Line 'Sigl' in 'tst''
  684.       say 'ftpfido has Error Exited'
  685.       call Lineout errlog ,date('N') Time('N') ':  ftpfido , An Error ('RC') has occurred on Line 'Sigl' in 'tst
  686.  
  687. exit:
  688. if hangup = 1 then do
  689. New = Directory(tcpbin)
  690. 'start /fs /c /b hangup.cmd 'killme
  691. end
  692. rc = stream(errlog,'C','close')
  693. rc = stream(logfile,'C','close')
  694. exit
  695.